<?php

final class NewsQueries {
    private static $getNews = "SELECT n.title, n.content, n.posted, n.edited, n.editedby, u.id as 'authourid', u.name as 'authour' FROM news AS n LEFT JOIN users AS u ON u.id = n.postedby ORDER BY n.posted DESC LIMIT 0, ?";
    
    private function __construct() {} // So the class can't be instantiated.

    public static function GetNews($nrOfNews) {
        $registry = Registry::GetInstance();
        $DB = $registry->Get('DB');
        $query = new pQuery(self::$getNews);
        $DB->Query($query, 'n');
        $query->SetParams($nrOfNews);
        return $query->FetchResult();
    }
}